<!--
 * @Descripttion: 
 * @version: 
 * @Author: wtzhang
 * @Date: 2021-09-24 14:51:56
 * @LastEditors: wtzhang
 * @LastEditTime: 2021-09-24 14:54:11
-->
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<style>
  body {
    height: 3000px;
  }
  div {
    height: 60px;
    width: 100%;
    background-color: pink;
    /* 开启粘性定位 */
    position: sticky;
    top: 5px;
  }
</style>
<body>
  <div>粘性定位</div>
  <p>asdssadasdas</p>
</body>
</html>